--[[ 编码: WMS-04-13 名称: 查询面板-库区变化后 作者:HAN 日期:2025-1-29 级别:固定 (说明本段代码在项目中不太会变化) 函数: AreaChange 功能: 需要设置 巷道、排下拉列表 更改记录: --]] json = require ("json") mobox = require ("OILua_JavelinExt") m3 = require("oi_base_mobox") function AreaChange( strLuaDEID ) local nRet, strRetInfo local parameter = {} local attrs -- 获取查询面板里的输入的仓库编码属性 nRet, parameter = m3.GetSysInputParameter( strLuaDEID ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "m3.GetSysInputParameter 失败! "..attrs ) end attrs = m3.KeyValueAttrsToObjAttr( parameter ) local area_code = lua.Get_StrAttrValue( attrs.S_AREA_CODE ) if ( area_code == '' or area_code == nil ) then return end -- 查询货位里的巷道库区编码 local strCondition local strOrder = 'N_AISLE' strCondition = "S_AREA_CODE = '"..area_code.."'" nRet, strRetInfo = mobox.groupDataObjAttr( strLuaDEID, "Location", strCondition, "N_AISLE", strOrder ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "无法从【货位】中获取信息!"..strRetInfo ) end local groups = json.decode( strRetInfo ) local n local value = {} if ( #groups == 0 ) then value = { { attr = "Aisle", value = "" }, { attr = "Row", value = "" } } else local aisle_choice_items = {} for n = 1, #groups do table.insert( aisle_choice_items, groups[n].value ) end value[1] = { attr = "Aisle", value = "", choice_list = aisle_choice_items } strOrder = "N_ROW" nRet, strRetInfo = mobox.groupDataObjAttr( strLuaDEID, "Location", strCondition, "N_ROW", strOrder ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "无法从【货位】中获取信息!"..strRetInfo ) end groups = json.decode( strRetInfo ) if ( #groups == 0 ) then value[2] = { attr = "Row", value = "" } else local row_choice_items = {} for n = 1, #groups do table.insert( row_choice_items, groups[n].value ) end value[2] = { attr = "Row", value = "", choice_list = row_choice_items } end end local action = { { action_type = "set_dlg_attr", value = value }, { action_type = "click_query_button", value = "" } } lua.Debug( strLuaDEID, debug.getinfo(1), "action", action ) nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str( action ) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end end